class packet(object):
  pkt_id = 0

  size_f = 1
  age = 0

  src = -1
  dest = -1

  # Actual packet info
  priority = 0
  cmd = 0
  desc = 0
  extra = None
  
  # For routing purposes:
  first_f = 0
  last_f = 0
  u_first_f = 0
  u_last_f = 0

  def __init__(self, new_size):
    if(new_size > 0):
      self.size_f = new_size
      self.u_first_f = 0
      self.u_last_f = new_size
    
      self.pkt_id = packet.pkt_id
      packet.pkt_id += 1

  def get_age(self):
    return self.age

  def copy_from(self, model):
    self.pkt_id = model.pkt_id
    self.size_f = model.size_f
    self.age = model.age
    
    self.src = model.src
    self.dest = model.dest
    self.extra = model.extra
    
    self.priority = model.priority
    self.cmd = model.cmd
    self.desc = model.desc

  def compare(self, model):
    return (self.pkt_id == model.pkt_id)

  # returns true if entire packet is here
  def valid(self):
    return (self.last_f == self.size_f)
